<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>显示学生的详细信息</title>
    <script type="text/javascript" src="../../js/jquery-1.8.3.js"></script>
    <script type="text/javascript">
        /*分页调用返回控制器的函数*/
        function toPage(page) {
            location.href="/user/byPager.ev?currPage="+page;
        }
        $(function () {
            //从控制器中拿到单前页
            var currPage=${pager.currPage};
            //从控制器中拿到总页
            var totalPages=${pager.toatPages};
            alert(totalPages)

            alert(currPage);
            if(currPage==1){
                $("#prev").removeAttr("href");
            }
            if(currPage==totalPages){
                $("#next").removeAttr("href");
            }
        });
    </script>
</head>
<body>
    <center>
        <h1 style="color: blue">学生详细信息</h1>
    </center>
    <table border="1" width="60%" align="center">
        <tr align="center">
            <td>学生编号</td>
            <td>学生姓名</td>
            <td>学生地址</td>
            <td>出生日期</td>
            <td>操作</td>
        </tr>
        <c:forEach items="${list}" var="user">
        <tr align="center">
            <td>${user.stuNo}</td>
            <td>${user.stuName}</td>
            <td>${user.stuAddress}</td>
            <td>${user.stuBornDate}</td>
            <td>
                <a href="/user/delete.ev?sid=${user.sid}">删除</a>
                <a href="/user/studentIdFind.ev?sid=${user.sid}">修改</a>
                <a href="/user/addStudents.ev">新增学生信息</a>
            </td>
        </tr>
        </c:forEach>
    </table>
<center>
    <a href="javaScript:toPage(1)">首页</a>
    <a id="prev" class="name" href="javaScript:toPage(${pager.currPage-1})" >上一页</a>
    <a id="next" href="javaScript:toPage(${pager.currPage+1})" >下一页</a>
    <a href="javaScript:toPage(${pager.toatPages})">尾页</a>
</center>
</body>
</html>
